<?php
/* 
 *******************************************************************
 | Copyright (c) 2007-2008 Clip-Bucket.com. All rights reserved.	
 | @ Author   : ArslanHassan										
 | @ Software : ClipBucket , ?PHPBucket.com
 | @ Modified : June 14, 2009 by Arslan Hassan
 *******************************************************************
*/

define("THIS_PAGE","upload");
define("PARENT_PAGE","upload");

require 'includes/config.inc.php';



$pages->page_redir();
subtitle('upload');

//Checking if user is guest 
if(userid())
	$verify_logged_user = true;
else
	$verify_logged_user = false;

if(has_access('allow_video_upload',false,$verify_logged_user))
{
	$step = 1;
	if(isset($_POST['submit_data']))
	{
		$Upload->validate_video_upload_form(NULL,TRUE);
		if(empty($eh->error_list))
		{
			
			$file_name = time().RandomString(5);
			assign('file_name',$file_name);
            if($Upload->upload_app_icon($file_name,$_FILES['app_icon']) && $Upload->upload_app_screenshots($file_name,$_FILES['app_screenshot'])) {
			     $vid = $Upload->submit_upload(NULL, $file_name);
			     Assign('vid',$vid);
			     $step=3;
			}
		}
	}
	
	if(isset($_POST['submit_upload']))
	{
		$step=2;
//		$Upload->validate_video_upload_form(NULL,TRUE);
		if(empty($eh->error_list))
		{
//			$vid = $Upload->submit_upload();
			//echo $db->db_query;
			//Call file so it can activate video
			//exec(php_path()." ".BASEDIR."/actions/process_video.php ".$vid);
			$step=3;
		}
	}
	
	//Assigning Form Name [RECOMMEND for submitting purpose]
	Assign('upload_form_name','UploadForm');
		   
	//Adding Uploading JS Files
	$Cbucket->add_js(array('swfupload/swfupload.js'=>'uploadactive'));
	$Cbucket->add_js(array('swfupload/plugins/swfupload.queue.js'=>'uploadactive'));
	$Cbucket->add_js(array('swfupload/plugins/handlers.js'=>'uploadactive'));
	$Cbucket->add_js(array('swfupload/plugins/fileprogress.js'=>'uploadactive'));
}else
{
	$userquery->logincheck('allow_video_upload',true);
}

Assign('step',$step);

subtitle(lang('upload'));
//Displaying The Template
template_files('upload.html');
display_it();

?>